home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / coppermagnify.s < prev    next >
Text File  |  1993-11-09  |  43KB  |  2,166 lines

  1.  
  2. rout            ;when this is off, the routine-file will be
  3.             ;assembled, on=testing
  4.             
  5. ;debug            ;when this is on, colors in the background will
  6.             ;show how much time the routine needs.
  7.  
  8. ;ntsctest        ;when this is on, the routineplayer is in ntsc-mode
  9.  
  10. routinemode    equ    1    ;the routinemode !
  11.  
  12.  
  13. ; the first part of the source handles the things that are necessary to
  14. ; show the picture/copper and playing of the routine.
  15. ; the part between the "***" lines is the routine-source.
  16. ; at the bottom of the file, there are the necessary incbin-files who
  17. ; are needed to test the routine.
  18. ; these are saved with "save effect" in videotracker. they are raw
  19. ; data files which can be fonts,pictures,landscapes,vectorobjects
  20. ; etcetra.
  21. ; the incbin-files are put in the "variables" table, in the routine-
  22. ; player-handler
  23. ; the place where it's done can be found by searching for "!!!"
  24.  
  25.  
  26.     opt    a+    ;devpac 3 optimize
  27.     opt    o+
  28.  
  29.     ifd    rout
  30.     ;videotracker routine-test
  31.  
  32.     incdir    "videotracker:include/"
  33.     include    "exec/types.i"
  34.     include    "graphics/gfxbase.i"
  35.     include    "lvo/graphics_lib.i"
  36.     incdir    'videotracker:effect/'
  37.  
  38. vew_wid    equ    44
  39. vew_hgt    equ    290
  40. win_hgt    equ    117
  41. win_str    equ    $1a
  42.  
  43.     SECTION    1,CODE_C
  44. tus
  45.     lea    var,a1
  46.     move.l    #rotsrc,curpic1        ;picture !!!
  47.  
  48.  
  49.     move.l    ($4).w,a6
  50.     sub.l    a1,a1
  51.     jsr    -$126(a6)        ;findtask
  52.     move.l    d0,curtsk
  53.     move.l    d0,a0
  54.     move.l    $b8(a0),tskpri
  55.  
  56.     lea    dosnam,a1        ;doslib openen
  57.     moveq.l    #0,d0
  58.     move.l    (4).w,a6
  59.     jsr    -408(a6)        ;openlib
  60.     move.l    d0,doslib
  61.  
  62.     bsr.s    label5            ;videotracker opstarten
  63.     
  64.     move.l    curtsk,a0
  65.     move.l    tskpri,$b8(a0)
  66.     move.l    ($4).w,a6
  67.     jsr    -$84(a6)        ;forbid
  68.  
  69.     move.l    doslib,a1
  70.     move.l    (4).w,a6
  71.     jsr    -414(a6)        ;closelib
  72.  
  73.     moveq.l    #0,d0
  74.     rts
  75.     
  76. label5
  77.     move.l    (4).w,a6        ;workbench gedoe
  78.  
  79.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  80.  
  81.     ifd    ntsctest
  82.     move.b    #60,ntscmode        ;60 hertz (ntsc)
  83.     endc
  84.  
  85.     cmp.b    #50,ntscmode        ;ntsc ?
  86.     beq.s    str.ntsc
  87.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  88. str.ntsc
  89.  
  90.     move.l    (4).w,a6        ;68030 cache off 
  91.     jsr    -120(a6)
  92.  
  93.     btst.b    #1,297(a6)
  94.     beq.s    str.nfc
  95.     lea.l    str.ft,a5
  96.     jsr    -30(a6)
  97. str.nfc
  98.     jsr    -126(a6)
  99.     bra.s    str.fc
  100.     
  101. str.ft
  102.     dc.w    $4e7a,2
  103.     bclr    #0,d0
  104.     bset    #13,d0
  105.     dc.w    $4e7b,2
  106.     rte
  107. str.fc
  108.  
  109.     lea    cprjmp,a2        ;copjmp zetten !
  110.     move.l    #cprbck-8,d0
  111.     move.w    d0,6(a2)
  112.     swap    d0
  113.     move.w    d0,2(a2)
  114.  
  115.     lea    cprbck-8,a2        ;copstr zetten !
  116.     move.l    #cpr,d0
  117.     move.w    d0,6(a2)
  118.     swap    d0
  119.     move.w    d0,2(a2)
  120.  
  121.     bsr    cprsprrem        ;sprites legen
  122.  
  123.     lea    gfxnam,a1        ;graphics lib openen
  124.     move.l    (4).w,a6
  125.     jsr    -408(a6)        ;openlib
  126.     move.l    d0,a6
  127.     move.l    d0,gfxlib
  128.     move.l    38(a6),oldcprlist
  129.  
  130.     bset    #1,$bfe001
  131.     bsr    copbuf            ;copper vullen
  132.  
  133.     bsr    sysoff
  134.  
  135. gadrun
  136.     btst    #6,($bfe001).l
  137.     bne    gadrun
  138.  
  139. scrend
  140. scrend.play
  141.     bsr    syson
  142.  
  143.     move.l    gfxlib,a1
  144.     move.l    (4).w,a6
  145.     jsr    -414(a6)        ;closelib
  146.  
  147. scrend.qb
  148.     moveq.l    #0,d0    
  149.     rts
  150.     
  151.     ;vertical blank interrupt, no blits.
  152.     ;handles counters,interlace,sprite
  153.     ;level 3
  154.  
  155. intvb
  156.     bra.s    intvb.cnt
  157.     dc.l    'VIDU'
  158.     dc.l    'LOOP'
  159. intvb.cnt
  160.     movem.l    d0-d7/a0-a6,-(sp)
  161.     lea    ($dff000).l,a6
  162.  
  163.     move.w    $01e(a6),d0
  164.     btst    #5,d0            ;vblank ?
  165.     bne.s    intvb.vb
  166.  
  167.     bra.s    intcop.end
  168.  
  169. intvb.vb
  170.     bsr    grap
  171.     bsr    palctr            ;palette zetten
  172.     bsr.s    copbuf            ;copper vullen
  173.     
  174. intvb.end
  175.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  176.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  177.     rte
  178.  
  179. intcop.end
  180.     movem.l    (sp)+,d0-d7/a0-a6
  181.     move.l    intvbold,-(sp)
  182.     rts
  183.  
  184.     ;transmission buffer empty routine, BLIT !
  185.     ;handles routines,animations
  186.     
  187. inttbe                    ;tbe interrupt
  188.     movem.l    d0-d7/a0-a6,-(sp)
  189.     lea    ($dff000).l,a6
  190.  
  191.     move.w    $01e(a6),d0
  192.     btst    #0,d0            ;no tbe ?
  193.     beq.s    intdskblk
  194.  
  195.  
  196.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  197.     beq.s    inttbe.cop
  198.     btst    #2,($dff016).l
  199.     beq.s    inttbe.cop
  200.  
  201.     ifd    debug
  202.     move.w    #$700,$dff180
  203.     endc
  204.     
  205.     bsr    rotply            ;routineplayer BLIT !
  206.     bsr.s    copbuf            ;copper vullen
  207.  
  208.     ifd    debug
  209.     move.w    #$070,$dff180
  210.     endc
  211.     
  212. inttbe.cop
  213.  
  214. inttbe.end
  215.     move.w    #$0001,$09c(a6)
  216.     movem.l    (sp)+,d0-d7/a0-a6
  217.     rte
  218.  
  219. intdskblk
  220.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  221.     movem.l    (sp)+,d0-d7/a0-a6
  222.     move.l    inttbeold,-(sp)
  223.     rts
  224.  
  225.  
  226.     ;moves the copperbuffer to the copperlist
  227.     ;sort of double buffering
  228.     
  229. copbuf
  230.     movem.l    d0-d7/a0-a6,-(sp)
  231.  
  232.     lea    ($dff000).l,a6
  233.  
  234. copbuf.novb                ;copperchange overslaan
  235.     moveq.l    #0,d0
  236.     move.b    $005(a6),d0
  237.     lsl.w    #8,d0
  238.     moveq.l    #0,d1
  239.     move.b    $006(a6),d1
  240.     add.w    d1,d0
  241.  
  242.     cmp.w    #$4,d0
  243.     blt    copbuf.novb
  244.  
  245.     cmp.b    #50,ntscmode
  246.     beq.s    copbuf.pal
  247.     cmp.w    #$133-56-8,d0        ;ntsc grens
  248.     bge    copbuf.novb
  249.     bra.s    copbuf.cont
  250. copbuf.pal
  251.     cmp.w    #$133-8,d0        ;pal grens
  252.     bge    copbuf.novb
  253. copbuf.cont
  254.  
  255.     lea    gra.s,a0        ;buffer copieren
  256.     lea    cprbuf,a1
  257.  
  258.     move.w    00*4+2(a0),00*4+2(a1)
  259.     move.w    01*4+2(a0),01*4+2(a1)
  260.     move.w    02*4+2(a0),02*4+2(a1)
  261.     move.w    03*4+2(a0),03*4+2(a1)
  262.     move.w    04*4+2(a0),04*4+2(a1)
  263.     move.w    05*4+2(a0),05*4+2(a1)
  264.     move.w    06*4+2(a0),06*4+2(a1)
  265.     move.w    07*4+2(a0),07*4+2(a1)
  266.     move.w    08*4+2(a0),08*4+2(a1)
  267.     move.w    09*4+2(a0),09*4+2(a1)
  268.  
  269.     move.w    10*4+2(a0),10*4+2(a1)
  270.     move.w    11*4+2(a0),11*4+2(a1)
  271.     move.w    12*4+2(a0),12*4+2(a1)
  272.     move.w    13*4+2(a0),13*4+2(a1)
  273.     move.w    14*4+2(a0),14*4+2(a1)
  274.     move.w    15*4+2(a0),15*4+2(a1)
  275.     move.w    16*4+2(a0),16*4+2(a1)
  276.     move.w    17*4+2(a0),17*4+2(a1)
  277.     move.w    18*4+2(a0),18*4+2(a1)
  278.     move.w    19*4+2(a0),19*4+2(a1)
  279.  
  280.     move.w    20*4+2(a0),20*4+2(a1)
  281.     move.w    21*4+2(a0),21*4+2(a1)
  282.     move.w    22*4+2(a0),22*4+2(a1)
  283.     move.w    23*4+2(a0),23*4+2(a1)
  284.     move.w    24*4+2(a0),24*4+2(a1)
  285.     move.w    25*4+2(a0),25*4+2(a1)
  286.     move.w    26*4+2(a0),26*4+2(a1)
  287.     move.w    27*4+2(a0),27*4+2(a1)
  288.     move.w    28*4+2(a0),28*4+2(a1)
  289.     move.w    29*4+2(a0),29*4+2(a1)
  290.  
  291.     move.w    30*4+2(a0),30*4+2(a1)
  292.     move.w    31*4+2(a0),31*4+2(a1)
  293.     move.w    32*4+2(a0),32*4+2(a1)
  294.     move.w    33*4+2(a0),33*4+2(a1)
  295.     move.w    34*4+2(a0),34*4+2(a1)
  296.     move.w    35*4+2(a0),35*4+2(a1)
  297.     move.w    36*4+2(a0),36*4+2(a1)
  298.     move.w    37*4+2(a0),37*4+2(a1)
  299.     move.w    38*4+2(a0),38*4+2(a1)
  300.     move.w    39*4+2(a0),39*4+2(a1)
  301.  
  302.     move.w    40*4+2(a0),40*4+2(a1)
  303.     move.w    41*4+2(a0),41*4+2(a1)
  304.     move.w    42*4+2(a0),42*4+2(a1)
  305.     move.w    43*4+2(a0),43*4+2(a1)
  306.     move.w    44*4+2(a0),44*4+2(a1)
  307.     move.w    45*4+2(a0),45*4+2(a1)
  308.     move.w    46*4+2(a0),46*4+2(a1)
  309.     move.w    47*4+2(a0),47*4+2(a1)
  310.     move.w    48*4+2(a0),48*4+2(a1)
  311.     move.w    49*4+2(a0),49*4+2(a1)
  312.  
  313.     move.w    50*4+2(a0),50*4+2(a1)
  314.     move.w    51*4+2(a0),51*4+2(a1)
  315.     move.w    52*4+2(a0),52*4+2(a1)
  316.     move.w    53*4+2(a0),53*4+2(a1)
  317.     move.w    54*4+2(a0),54*4+2(a1)
  318.  
  319. copbuf.end
  320.     movem.l    (sp)+,d0-d7/a0-a6
  321.     rts
  322.  
  323.     ;goes back to the workbench
  324.     
  325. syson
  326.     movem.l    d0-d7/a0-a6,-(sp)
  327.  
  328.     move.w    #$0001,$dff09a        ;tbeint uit
  329.     move.l    intvbold,($6c).w
  330.     move.l    inttbeold,($64).w
  331.  
  332.     move.l    4,a6
  333.     jsr    -138(a6)        ;permit
  334.  
  335.     move.l    gfxlib,a6
  336.     jsr    -462(a6)        ;disownblitter
  337.  
  338.     move.l    wbview,a1
  339.     move.l    gfxlib,a6
  340.     jsr    _LVOLoadView(a6)     ; Fix view
  341.     jsr    _LVOWaitTOF(a6)
  342.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  343.  
  344. syson.ras
  345.     cmp.b    #$c0,$dff006        ;prevent copperjump
  346.     bne    syson.ras
  347.  
  348.     move.l    gfxlib,a6
  349.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  350.  
  351.     movem.l    (sp)+,d0-d7/a0-a6
  352.     rts
  353.     
  354.     ;goes back to the gadgetscreen
  355.     
  356. sysoff
  357.     movem.l    d0-d7/a0-a6,-(sp)
  358.      
  359.     move.l    gfxlib,a6
  360.     move.l    gb_ActiView(a6),wbview    ;current view
  361.     sub.l    a1,a1            ; clear a1
  362.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  363.     jsr    _LVOWaitTOF(a6)     ; Wait once
  364.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  365.  
  366.     move.l    gfxlib,a6
  367.     jsr    -456(a6)        ;ownblitter
  368.  
  369.     move.l    4,a6
  370.     jsr    -132(a6)        ;forbid
  371.         
  372.     move.l    ($6c).w,intvbold
  373.     move.l    #intvb,($6c).w
  374.     move.l    ($64).w,inttbeold
  375.     move.l    #inttbe,($64).w
  376.     move.w    #$8001,$dff09a        ;tbeint aan
  377.     bsr    gracpr            ;reset copper
  378.     bsr    copbuf            ;copy copper
  379.     move.l    #cpr,$dff080
  380.  
  381.     movem.l    (sp)+,d0-d7/a0-a6
  382.     rts
  383.     
  384. cprsprrem
  385.     movem.l    d0-d7/a0-a6,-(sp)
  386.     lea    cprspr,a0
  387.     move.l    #sprdat,d0
  388.     move.w    #7,d1
  389. cprsprrem.a
  390.     move.w    d0,3*2(a0)
  391.     swap    d0
  392.     move.w    d0,1*2(a0)
  393.     swap    d0
  394.     add.l    #8,a0
  395.     dbra    d1,cprsprrem.a
  396.     movem.l    (sp)+,d0-d7/a0-a6
  397.     rts
  398.  
  399. varset                    ;variablen neerzetten
  400.     movem.l    d0-d7/a0-a6,-(sp)
  401.     move.l    #var,a0
  402.  
  403.     move.l    #cprbck,var_cprbck(a0)
  404.     move.l    gfxlib,var__GfxBase(a0)
  405.     move.b    ntscmode,var_ntsc(a0)
  406.  
  407.     move.l    curpic1,var_pic1(a0)    ;variabel
  408.     move.l    curpic2,var_pic2(a0)    ;variabel
  409.     move.w    anispd1,var_anispd1(a0)
  410.     move.w    anitel1,var_anitel1(a0)
  411.     movem.l    (sp)+,d0-d7/a0-a6
  412.     rts
  413.     
  414.     ;this routine handles all videotracker-routines
  415.  
  416. rotply    
  417.     movem.l    d0-d7/a0-a6,-(sp)
  418.  
  419.     moveq.l    #0,d0
  420.  
  421.     lea    currot1,a2        ;routine 1
  422.     move.w    rotinf1,d0        ;routine info
  423.     bsr.s    rotplyr
  424.  
  425. rotply.end
  426.     movem.l    (sp)+,d0-d7/a0-a6
  427.     rts
  428.  
  429.     ;this routine handles 1 routine, BLIT !
  430.     
  431. rotplyr
  432.     movem.l    d0-d7/a1-a6,-(sp)
  433.  
  434.     move.l    #rot,(a2)        ;rou